<div class="container">
   <div class="post-product-wapper">
      <?php $form=$this->beginWidget('CActiveForm', array(
      	'id'=>'user-form',
      	// Please note: When you enable ajax validation, make sure the corresponding
      	// controller action is handling ajax validation correctly.
      	// There is a call to performAjaxValidation() commented in generated controller code.
      	// See class documentation of CActiveForm for details on this.
      	'enableAjaxValidation'=>false,
      )); ?>
      <div class="ai-header">
         <span>Thông tin liên hệ</span>
         <span class="header-notice">(Vui lòng cập nhật đầy đủ thông tin)</span>
      </div>
      
      <ul class="form-list">
         <li class="form-row">
            <?php echo $form->labelEx($user_info,'name').' :'?>
            <?php echo $user_info->name;?>
         </li>
         <li class="form-row">
            <?php echo $form->labelEx($user_info,'phone_number').' :'?>
            <?php echo $user_info->phone_number;?>
         </li>
         <li class="form-row">
            <?php echo $form->labelEx($user_info,'email').' :'?>
            <?php echo $user_info->email;?>
         </li>
         <li class="form-row">
            <?php echo $form->labelEx($user_info,'address').' :'?>
            <?php echo $user_info->address;?>
         </li>
      </ul>
      
      <div class="ai-header">
         <span>Nội dung bài đăng</span>
         <span class="header-notice">(Vui lòng cập nhật đầy đủ thông tin)</span>
      </div>   
      <ul class="info-product">
         <li class="form-row">
            <?php echo $form->labelEx($model,'cat_id').':'?>
            <?php 
               $all_cate = Category::model()->getAll();
               $tree_cate = Category::model()->getTree($all_cate,0,array('-- Chọn chuyên mục --'));
               echo $form->dropDownList($model,'cat_id',$tree_cate);
            ?>
         </li>
         <li class="form-row">
            <?php echo CHtml::label('Bạn đăng tin','Product_type') . ':'?>
            <?php 
               echo $form->radioButtonList($model,'type',array(
                  0 => 'Cần bán',
                  1 => 'Cần mua',
               ),array(
                  'separator'=>'',
                  'template' => "<span>{input}</span><span>{label}</span>"
               ));
            ?>
         </li>
         
         <li class="form-row">
            <?php echo $form->labelEx($model,'name').':'?>
            <?php 
               echo $form->textField($model,'name',array(
                  'style' => 'width:400px',
                  'placeholder' => 'Tiêu đề bài đăng của bạn'
               ));
            ?>
         </li>
         <li class="form-row">
            <?php echo $form->labelEx($model,'des').':'?>
            <?php 
               echo $form->textArea($model,'des',array(
                  'style' => 'width:400px;height:200px;resize:none;border-color: #999;font-size: 13px;color: #545454;',
                  'placeholder' => 'Hãy mô tả chi tiết sản phẩm bạn muốn rao bằng tiếng Việt có dấu',
               ));
            ?>
         </li>
         <li class="form-row">
            <?php echo $form->labelEx($model,'price').':'?>
            <?php 
               echo $form->textField($model,'price',array(
                  'style' => 'width:200px',
               ));
            ?>
            <span>VNĐ</span>
         </li>
         
         <li class="form-row">
            <?php echo CHtml::label("Hình ảnh :","",array('class' => 'left'))?>
            <div class="box-upload-image">
               <div class="tip-image">
                  <span>Những tin có ảnh sẽ mang lại hiệu quả cho bạn hơn rất nhiều</span>
               </div>
               <ul>
                  <?php for($i =1; $i <=6; $i++){?>
                     <li class="item-upload relative">
                        <i class="fa fa-picture-o"></i>
                        <input type="file" class="general-input"/>
                        <input type="hidden" class="hidden-input" name="Product_image[]" id="product_image_<?php echo $i?>" />
                        <div class="absolute preview">
                        </div>
                     </li>
                  <?php }?>
                  
               </ul>
            </div>
         </li>
         
         <li class="form-row">
            <?php echo CHtml::label("&nbsp","",array('class' => 'left'))?>
            <?php echo CHtml::submitButton("Gửi",array('class' => 'btn btn-lg btn-success'));?>
         </li>
      </ul>
      
      <?php $this->endWidget(); ?>
   </div>
</div>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/ajaxupload.js"></script>

<script>
   $(document).ready(function(){
      $(".general-input").ajaxupload({
         urlUpload:'/product/uploadimage'
      });
      
      $("#Product_price").keyup(function(){
         $(this).val(formatNumber($(this).val()));
      })
   });
</script>
